﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Utils.DatabaseUtils;
using Utils;

namespace Entity
{
    public class SizeUI
    {
        int _Size_ID;

        public int Size_ID
        {
            get { return _Size_ID; }
            set { _Size_ID = value; }
        }

        string _Size_Name;

        public string Size_Name
        {
            get { return _Size_Name; }
            set { _Size_Name = value; }
        }

        float _Price;

        public float Price
        {
            get { return _Price; }
            set { _Price = value; }
        }

        public int Add(string Size_Name, float Price)
        {
            try
            {
                int result = SqlHelper.ExecuteNonQuery(Common.Conn, "Size_add", Size_Name, Price);
                return result;
            }
            catch(Exception ex)
            {
                return -1;
            }
        }

        public int Delete(int Size_ID)
        {
            try
            {
                int result = SqlHelper.ExecuteNonQuery(Common.Conn, "Size_delete", Size_ID);
                return result;
            }
            catch (Exception ex)
            {
                return -1;
            }
        }

        public DataSet Get(int Size_ID)
        {
            try
            {
                DataSet result = SqlHelper.ExecuteDataset(Common.Conn, "Size_get", Size_ID);
                return result;
            }
            catch (Exception e) { return null; }
        }

        public DataSet GetAll()
        {
            try
            {
                DataSet result = SqlHelper.ExecuteDataset(Common.Conn, "Size_getall");
                return result;
            }
            catch (Exception e) { return null; }
        }

        public int Update(int Size_ID,string Size_Name, float Price)
        {
            try
            {
                int result = SqlHelper.ExecuteNonQuery(Common.Conn, "Size_update", Size_ID, Size_Name, Price);
                return result;
            }
            catch (Exception ex)
            {
                return -1;
            }
        }

    }
}
